package org.mcjug.locationmailer.model;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

public class Email implements Parcelable {
	private String sender;
	private List<String> recipients = new ArrayList<String>();
	private String subject;
	private String body;

	public Email() {
	}
	
	public Email(String sender, List<String> recipients, String subject, String body) {
		this.sender = sender;
		this.recipients = recipients;
		this.subject = subject;
		this.body = body;
	}

	public Email(Parcel parcel) {
		readFromParcel(parcel);
	}

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	public List<String> getRecipients() {
		return recipients;
	}

	public void setRecipients(List<String> recipients) {
		this.recipients = recipients;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public int describeContents() {
		return 0;
	}

	private void readFromParcel(Parcel parcel) {
		sender = parcel.readString(); 
	    parcel.readStringList(recipients);
		subject = parcel.readString(); 
		body = parcel.readString();	
	}

	public void writeToParcel(Parcel parcel, int ignored) {
		parcel.writeString(sender);
		parcel.writeStringList(recipients);
		parcel.writeString(subject);
		parcel.writeString(body);
	}
	
	public static final Parcelable.Creator<Email> CREATOR = new Parcelable.Creator<Email>() {
		
		public Email createFromParcel(Parcel parcel) {
			return new Email(parcel);
		}
		
		public Email[] newArray(int size) {
			return new Email[size];
		}
	};
}
